10. Strategy
Strategy
ND079 JPND C2 L03 A11 Strategy
What is the Strategy Pattern?
- You define an interface to represent a kind of task or problem.
- Each concrete implementation defines a different "strategy" for solving the task.
- The strategies can be swapped for each other because callers code against the interface.
SOLUTION:
- Client code is agnostic of which concrete implementation is being used.
- The strategies can be swapped at any time.
- An interface defines a task. There may be many concrete implementations.